<head>
<meta charset="utf-8">
<meta name="X-UA-Compatible" content="IE=edge">
<meta name="google-site-verification" content="{{ .Site.Params.googleSiteVerification }}">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
<meta content="telephone=no" name="format-detection">

{{ $description := .Params.description}}
{{if .IsHome}}
  {{ $description = .Site.Params.description}}
{{end}}

<meta name="description" content="{{ $description }}">
<meta name="renderer" content="webkit">
<meta name="theme-color" content="#ffffff">

{{ if .IsHome }}
<title>{{.Title}}</title>
{{ else }}
<title>{{.Title}} | {{.Site.Title}}</title>
{{ end }}


<!-- open-graph -->
{{if .Site.Params.enableOpenGraph}}
{{ template "_internal/opengraph.html" . }}
{{end}}

<!-- twitter-cards -->
{{if .Site.Params.enableTwitterCards}}
{{ template "_internal/twitter_cards.html" . }}
{{end}}

<!-- metadata -->

{{ if .Site.GoogleAnalytics }}
{{ template "_internal/google_analytics.html" . }}
{{ end }}

<link type="text/css" rel="stylesheet" href="{{"/vendor/css/bootstrap.min.css" | relURL}}">

{{ if .Site.Params.debug }}
  <script src="{{"/vendor/js/vue.global.js" | relURL}}" defer="defer"></script>
{{ else }}
  <script src="{{"/vendor/js/vue.global.prod.js" | relURL}}" defer="defer"></script>
{{ end }}

{{if .Site.Params.manifest}}
<link rel="manifest" href="{{.Site.Params.manifest}}">
{{end}}

{{ if .Site.Params.favicon }}
<link rel="icon" href="{{ .Site.Params.favicon | absURL }}">
<!-- favicon -->
{{ end }}

{{- partial "favicon.html" . -}}

{{ $styles := resources.Get "scss/tj.scss" | toCSS | minify | fingerprint }}
<link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Integrity }}" media="screen">
{{/*  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lora|Montserrat|Fira+Mono|Noto+Serif+SC|Material+Icons&display=swap">  */}}
<script src="{{ "/js/loadCSS.js" | relURL }}" defer="defer"></script>
<script src="{{ "/js/web-font.js" | relURL }}" defer="defer"></script>


{{ if .Params.enableMathJax }}
  {{ partial "mathjax.html" . }}
{{ end }}

{{ if and (.Site.Params.enableGitalk) (.IsPage) }}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css">
<script src="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js"></script>
<script src="{{"/vendor/js/md5.min.js" | relURL}}"></script>
<script>
  var gitalk = new Gitalk({
  clientID: '{{ .Site.Params.Gitalk.client_id }}',
  clientSecret: '{{ .Site.Params.Gitalk.client_secret }}',
  repo: '{{ .Site.Params.Gitalk.repo }}',
  owner: '{{ .Site.Params.Gitalk.owner }}',
  admin: ['{{ .Site.Params.Gitalk.owner }}'],
  id: md5(location.pathname),
  distractionFreeMode: 'false'
  });
  window.onload = function () {
        gitalk.render('gitalk-container')
  }
</script>
{{ end }}

{{ if and (.Site.Params.livereId) (.IsPage) }}
<script type="text/javascript">
$(
  (function(d, s) {
      var j, e = d.getElementsByTagName(s)[0];

      if (typeof LivereTower === 'function') { return; }

      j = d.createElement(s);
      j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
      j.async = true;

      e.parentNode.insertBefore(j, e);
  })(document, 'script'));
</script>
{{ end }}

{{ if and (.Site.Params.enableValine) (.IsPage) }}
<script src='https://unpkg.com/valine@1.4.14/dist/Valine.min.js'></script>
{{ end }}

{{ if .Site.Params.disqusShortname }}
<script src="https://cdn.jsdelivr.net/npm/vue-disqus@3/dist/vue-disqus.js"></script>
{{ end }}

</head>
